package de.carcophan.jimdb.gwt.shared.entites;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

@Entity
public class UserMovies implements Serializable {

   private static final long serialVersionUID = 1L;

   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   private int id;
   @ManyToOne(fetch=FetchType.LAZY)
   private User user;
   @OneToOne(fetch=FetchType.EAGER)
   private Movie movie;

   @Temporal(TemporalType.TIMESTAMP)
   private Date changedDate;
   @Version
   private int version;
   @OneToOne(fetch=FetchType.EAGER)
   private Tag tag;

   public Tag getTag() {
      return tag;
   }

   public void setTag(Tag tag) {
      this.tag = tag;
   }

   public int getVersion() {
      return version;
   }

   public void setVersion(int version) {
      this.version = version;
   }

   public int getId() {
      return id;
   }

   public Date getChangedDate() {
      return changedDate;
   }

   public void setChangedDate(Date changedDate) {
      this.changedDate = changedDate;
   }

   public void setId(int id) {
      this.id = id;
   }

   public User getUser() {
      return user;
   }

   public void setUser(User user) {
      this.user = user;
   }

   public Movie getMovie() {
      return movie;
   }

   public void setMovie(Movie movie) {
      this.movie = movie;
   }

}
